package com.cnhis.cloudhealth.clidoctorweb.gzip;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;

/**
 * 这只是示例，可以参考MyWriter
 * @author Administrator
 *
 */
public class MyOutputStream extends ServletOutputStream {
	private ServletOutputStream outputStream;
	public  ByteArrayOutputStream ByteArrayOutputStream1 = new ByteArrayOutputStream(); 
	
	public MyOutputStream(ServletOutputStream outputStream) {
		this.outputStream = outputStream;
	}

	@Override
	public void write(int b) throws IOException {
		outputStream.write(b);
		ByteArrayOutputStream1.write(b);
		System.out.println("output1");
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		super.write(b, off, len);
		ByteArrayOutputStream1.write(b, off, len);
		System.out.println("output2");
	}

	@Override
	public void write(byte[] b) throws IOException {
		super.write(b);
		ByteArrayOutputStream1.write(b);
	 
		System.out.println("output3");
	}

	@Override
	public boolean isReady() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setWriteListener(WriteListener writeListener) {
		// TODO Auto-generated method stub
		
	}

}
